//
//  LHdataModel.m
//  QuickCure
//
//  Created by 小灰灰 on 16/9/13.
//  Copyright © 2016年 haoge. All rights reserved.
//

#import "LHdataModel.h"
#import "NetWorkDefine.h"
#import "NetWorkTool.h"

@implementation LHdataModel
+(instancetype)dataModelWithDic:(NSDictionary *)dic
{
    LHdataModel *dataModel =[[LHdataModel alloc] init];
    [dataModel setValuesForKeysWithDictionary:dic];
    return dataModel;
}
-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}
+(void)dataListWithSuccessBlock:(void(^)(NSArray *dataArr))successBlock errorBlock:(void(^)())errorBlock
{
    NSString *urlString = kSearchCI3Url;
    NSDictionary *paramDic = @{
                               @"page_size":@15,
                               @"page":@1,
                               @"ci1_id":@1,
                               @"keyword":@""
                               };
    
    [[NetWorkTool shareManager] POST_RequestWithUrlString:urlString parmas:paramDic successBloock:^(id responseObject) {
        NSMutableArray *muArr =[NSMutableArray array];
        NSArray *dataArr = responseObject[@"data"];
 
        for (NSDictionary *dataDic in dataArr) {
            LHdataModel *dataModel =[LHdataModel dataModelWithDic:dataDic];
            [muArr addObject:dataModel];
        }
        
        if(successBlock)
        {
            successBlock(muArr.copy);
        }
        
    } failureBlock:^(NSError *error) {
        
        NSLog(@"error = %@",error);
    }];

}
@end
